<?php
require_once(APPPATH."models/base.php");

class site_info_model extends base_model
{	
	public function get_seo()
	{
		return $this->db->get_where('seo',array('type'=>'site_info'))->row();
	}
}

class site_info_manager extends base_manager
{
	public function get($load_type = Load_Type::Lazy)
	{
		$site_info =
			 $this->convert($this->db->get_where('site_info',array('language'=>'cn'))->row());
		
		
		if($load_type == Load_Type::Normal)
		{
			$site_info->seo = $site_info->seo;  
		}
		
		// print_r($site_info);
		return $site_info;
	}
	
	public function update($obj,$params = array('id'=>1))
	{
		// 对象操作暂不支持
		if(is_array($obj))
		{
			$post_seo = array_remove($obj,'seo');
			parent::update($obj, $params) ;
			if($post_seo != null)
			{
				$this->db->update('seo',$post_seo,array('type'=>'site_info'));
			}  
		}
	}
	
	public function insert()
	{
		die("");
	}
	public function delete(){
		die("") ;  
	}
}

?>